# Check that 'watchpoint set' errors out gracefully when we can't set dbregs
# and that new threads are monitored correctly even though we can't copy dbregs.

# REQUIRES: system-netbsd && (target-x86 || target-x86_64) && !dbregs-set
# RUN: %clang_host %p/Inputs/thread-dbreg.c -pthread -g -o %t.out
# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %s %t.out 2>&1 | FileCheck %s

settings show interpreter.stop-command-source-on-error
# CHECK: interpreter.stop-command-source-on-error (boolean) = false

b main
# CHECK: Breakpoint {{[0-9]+}}: where = {{.*}}`main
b thread_func
# CHECK: Breakpoint {{[0-9]+}}: where = {{.*}}`thread_func
run
# CHECK: stop reason = breakpoint
watchpoint set variable g_watchme
# CHECK: error: Watchpoint creation failed
cont
# CHECK: stop reason = breakpoint
cont
# CHECK: Process {{[0-9]+}} exited with status = 0
